<!DOCTYPE html>
<%@page import="java.util.ArrayList"%>
<%@page import="mwa.cs.model.Reader"%>
<%@ page contentType="text/html;charset=UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ include file="../admin/authority.jsp" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta content="width=device-width, initial-scale=1.0" name="viewport" />
<%@include file="headScriptRC.jsp"%>
<script type="text/javascript" src="../assets/js/rc/cs54001script.js"></script>
<script type="text/javascript">
var vaStatusSave = '${vaStatusSaveButton}';
var vaPageSetting ='${vaPageSetting}';
var vaStatusIsUpdate = '${vaStatusUpdate}';
var vaErrorMsg = '${vaErrorMsg}';
var vaStep2ErrorMsg ='${vaStep2ErrorMsg}';
</script>
</head>
<body>
	<input type="hidden" name="userId" id="userId" value ="${user_id}">
	<input type="hidden" name="siteId" id="siteId" value ="${site_id}">
	<div class="wrapper">
		<!-- BEGIN Top-Bar -->
		<%@ include file="../fragments/header.jsp"%>
		<!-- END Top-Bar -->

		<div id="detail-area" class="clearfix">
			<!-- BEGIN SIDEMENU -->
			<div class="hidden-xs hidden-sm page-sidebar" id="side-menu-bar">
				<ul class="page-sidebar-menu">					

					<!-- <div id="displaymenu"></div>  -->
					<%@ include file="../admin/menu.jsp" %>

				</ul>
			</div>
		<!-- End SIDEMENU--> 
		
		<div class="col-sm-12 col-xs-12" id="right-side">
			
			<div id="navigator-bar"><i class="fa fa-home"></i> หน้าหลัก <i class="fa fa-angle-right ml-5 mr-5"></i> ปิดการรับเงินประจำวัน</div><!--End navigator-bar-->
			<div>
			<div id="page-header" class="clearfix">
				<div>ปิดการรับเงินประจำวัน</div>
				
			</div>
				
				<div class="form-step-nav">
					<div id="step-way"></div>
					<div class="form-step-box box-first">
						<a id="manage_getmoney" href="javascript:void()" data-link="form-1" class="step-link active">1</a>
						<div class="step-text" >จัดการรับเงิน</div>
					</div>
					
					<div class="form-step-box box-2">
						<a id="summary_getmoney" href="javascript:void()" data-link="form-2" class="step-link">2</a>
						<div class="step-text" >สรุปการรับเงินประจำวัน</div>
					</div>
					
					<div class="form-step-box box-last">
						<a id="report_getmoney" href="javascript:void()"  data-link="form-3" class="step-link">3</a>
						<div class="step-text" >รายงาน</div>
					</div>
					
				</div><!-- End form-nav-->
				
				<div id="form-1" class="form-step">
				
				<div class="form-detail clearfix" >
				
	
						<h4><i class="fa fa-file-text-o"></i> จัดการรับเงิน</h4>
						<table  class="table-list mt-10" >	
							<tr>
								<th width="30%">ประเภทเงินได้</th>
								<th width="20%">จำนวน (บาท)</th>
								<th width="20%">ภาษี (บาท)</th>
								<th width="30%">จำนวนเงินรวม (บาท)</th>								
							</tr>
						<c:choose>
							<c:when test="${vaErrorMsg == 'no' }">
								<c:choose>
								<c:when test="${voStepOneReceiveCode21.vnBillAmount != 0.0 && voStepOneReceiveCode21.vnVatAmount != 0.0 }">
								<tr class="odd">
									<td style="text-align:left">ค่าน้ำ (ค่าน้ำ + ค่าบริการ)</td>
									<td style="text-align:right"><fmt:formatNumber value="${voStepOneReceiveCode21.vnBillAmount}" pattern="###,##0.00"/></td>
									<td style="text-align:right"><fmt:formatNumber value="${voStepOneReceiveCode21.vnVatAmount}" pattern="###,##0.00"/></td>
									<td style="text-align:right"><fmt:formatNumber value="${voStepOneReceiveCode21.vnBillAmount + voStepOneReceiveCode21.vnVatAmount }" pattern="###,##0.00"/></td>		
								</tr>
								</c:when>
							</c:choose>
							<c:choose>
								<c:when test="${voStepOneReceiveCode21.vnGarbageCharge != 0.0 }">
								<tr class="even">
									<td style="text-align:left">ค่าขยะ</td>
									<td style="text-align:right"><fmt:formatNumber value="${voStepOneReceiveCode21.vnGarbageCharge}" pattern="###,##0.00"/></td>
									<td style="text-align:right">0.00</td>
									<td style="text-align:right"><fmt:formatNumber value="${voStepOneReceiveCode21.vnGarbageCharge}" pattern="###,##0.00"/></td>		
								</tr>
								</c:when>
							</c:choose>
							<c:choose>
								<c:when test="${voStepOneReceiveCode21.vnWasteWaterCharge != 0.0 }">
								<tr class="odd">
									<td style="text-align:left">ค่าบำบัดน้ำเสีย</td>
									<td style="text-align:right"><fmt:formatNumber value="${voStepOneReceiveCode21.vnWasteWaterCharge}" pattern="###,##0.00"/></td>
									<td style="text-align:right">0.00</td>
									<td style="text-align:right"><fmt:formatNumber value="${voStepOneReceiveCode21.vnWasteWaterCharge}" pattern="###,##0.00"/></td>		
								</tr>
								</c:when>
							</c:choose>
							<c:choose>
								<c:when test="${voStepOneReceiveCode21.vnOtherCharge != 0.0 }">
								<tr class="even">
									<td style="text-align:left">ค่าอื่นๆ</td>
									<td style="text-align:right"><fmt:formatNumber value="${voStepOneReceiveCode21.vnOtherCharge}" pattern="###,##0.00"/></td>
									<td style="text-align:right">0.00</td>
									<td style="text-align:right"><fmt:formatNumber value="${voStepOneReceiveCode21.vnOtherCharge}" pattern="###,##0.00"/></td>		
								</tr>
								</c:when>
							</c:choose>
							<c:choose>
								<c:when test="${vnTotalPenalty != 0.0 }">
									<tr  class="odd">
										<td style="text-align:left" >ค่าปรับ</td>
										<td style="text-align:right" > <fmt:formatNumber value="${vnTotalPenalty }" pattern="###,##0.00"/></td>
										<td style="text-align:right">0.00</td>
										<td style="text-align:right" > <fmt:formatNumber value="${vnTotalPenalty }" pattern="###,##0.00"/></td>
									</tr>
								</c:when>
							</c:choose>
							<c:forEach var="voStepOneReceiveCodeNot21List" items="${voStepOneReceiveCodeNot21List}" varStatus="i">
								<c:choose>
									<c:when test="${i.count % 2 == 0 }">				
										<c:choose>
											<c:when test="${voStepOneReceiveCodeNot21List.vnGrossAmount - voStepOneReceiveCodeNot21List.vnVatAmount != 0.0 }">
											<tr class="even">
												<td style="text-align:left">${voStepOneReceiveCodeNot21List.vaReceiveDate}</td>
												<td style="text-align:right"><fmt:formatNumber value="${voStepOneReceiveCodeNot21List.vnGrossAmount - voStepOneReceiveCodeNot21List.vnVatAmount}" pattern="###,##0.00"/></td>
												<td style="text-align:right"><fmt:formatNumber value="${voStepOneReceiveCodeNot21List.vnVatAmount}" pattern="###,##0.00"/></td>
												<td style="text-align:right"><fmt:formatNumber value="${voStepOneReceiveCodeNot21List.vnGrossAmount}" pattern="###,##0.00"/></td>
											</tr>
											</c:when>
										</c:choose>	
									</c:when>
									<c:otherwise>
										<c:choose>
											<c:when test="${voStepOneReceiveCodeNot21List.vnGrossAmount - voStepOneReceiveCodeNot21List.vnVatAmount != 0.0 }">
												<tr class="odd">
													<td style="text-align:left">${voStepOneReceiveCodeNot21List.vaReceiveDate}</td>
													<td style="text-align:right"><fmt:formatNumber value="${voStepOneReceiveCodeNot21List.vnGrossAmount - voStepOneReceiveCodeNot21List.vnVatAmount}" pattern="###,##0.00"/></td>
													<td style="text-align:right"><fmt:formatNumber value="${voStepOneReceiveCodeNot21List.vnVatAmount}" pattern="###,##0.00"/></td>
													<td style="text-align:right"><fmt:formatNumber value="${voStepOneReceiveCodeNot21List.vnGrossAmount}" pattern="###,##0.00"/></td>	
												</tr>
											</c:when>
										</c:choose>	
									</c:otherwise>
								</c:choose>
							</c:forEach>
						<tr>
							<td style="text-align:right" colspan="3" >รวม</td>
							<td class="highlight-blue-2" style="text-align:right"> <fmt:formatNumber value="${vnSumRow21 + vnTotalPenalty }" pattern="###,##0.00"/></td>
						</tr>
						</c:when>
						<c:otherwise>
							<tr class="even"><td valign="top" colspan="4">ไม่พบรายการข้อมูล</td></tr>
						</c:otherwise>
					</c:choose>	
				</table>						
				</div>
				<!-- End form-detail -->
				<c:choose>
					<c:when test="${vaErrorMsg == 'no' }">
						<div id="div_save_step1" ></div>
					</c:when>
					<c:otherwise>
						<div class='form-detail' style='text-align:center; margin-top:-50px'> <button type='button'  class='btn btn-primary' id='btnSave_step1' disabled="disabled" name='btnSave_step1'><i class='fa fa-floppy-o'></i> บันทึก</button></div>
					</c:otherwise>
				</c:choose>		
			<!-- message confirm  of button save -->
			<form class="form-inline" role="form" action="CS54001Srvl" method="POST">
				<input type="hidden" id="url_address" name="url_address" value="">
				<input type="hidden" id="agent_browser" name="agent_browser" value="">
				<div class="modal fade" id="myModalMessageConfirm">
				  <div class="modal-dialog" style="width:400px">
				    <div class="modal-content">
				       <div class="modal-header">
				        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
				        <h4 class="modal-title">ปิดการรับเงินประจำวัน</h4>
				      </div>
				      <div class="modal-body" >
				        <p><span class="fa-stack fa-lg mr-10" style=" color:#FC0"> <i class="fa fa-exclamation-triangle fa-stack-2x"></i></span> ยืนยันปิดการรับเงินประจำวัน</p>
				      </div>
				      <div class="modal-footer">
						<input type="hidden"  class="btn btn-primary" name="btn_save" id="btn_save" value="no">
						<button type="submit" class="btn btn-primary" onclick="checkButtonClick('btn_save');"><i class="fa fa-floppy-o"></i> ยืนยัน</button>
										     	<button type="button" class="btn btn-danger" data-dismiss="modal"><i class="glyphicon glyphicon-floppy-remove"></i> ยกเลิก</button>
				      </div>
				    </div><!-- /.modal-content -->
				  </div><!-- /.modal-dialog -->
				</div><!-- /.modal -->
			</form>
				</div>
				<!-- END form-1 -->
				
				
				<div id="form-2" class="form-step">
				
				<div class="form-detail clearfix">
				
						<h4><i class="fa fa-tablet"></i> สรุปการรับเงินประจำวัน</h4>
						<table  class="table-list mt-10" >
							
							<tr>
								<th style="width:10%">ลำดับ</th>
								<th style="width:15%" >รหัสพนักงาน</th>
								<th style="width:35%" >ชื่อ - นามสกุล</th>
								<th width="20%">จำนวนเงินรวม</th>
								<th width="20%">สถานะจัดการรับเงิน</th>							
							</tr>
							<c:choose>
								<c:when test="${vaStep2ErrorMsg == 'hide' }">
									<c:forEach var="voAlreadyGetMoneyList" items="${voAlreadyGetMoneyList}" varStatus="i"> 
									<c:set var="seqNumber">${i.count }</c:set>
									<tr class="odd">
										<td>${seqNumber }</td>
										<td>${voAlreadyGetMoneyList.vnReceiveEmployee }</td>
										<td style="text-align: left;">${voAlreadyGetMoneyList.vaAccount }</td>
										<td style="text-align: right;"><fmt:formatNumber value="${voAlreadyGetMoneyList.vnGrossAmount }" pattern="###,###.00"/></td>
										<td><span class="fa-stack fa-lg" style="color:green;"> <i class="fa fa-circle fa-stack-2x"></i> <i class="fa fa-check fa-stack-1x fa-inverse"></i> </span></td>
									</tr>	
									</c:forEach>
									<c:forEach var="voNotGetMoneyList" items="${voNotGetMoneyList}" varStatus="i"> 
									<tr class="odd">
										<td>${seqNumber + 1 }</td>
										<td>${voNotGetMoneyList.vnReceiveEmployee }</td>
										<td style="text-align: left;">${voNotGetMoneyList.vaAccount }</td>
										<td style="text-align: right;"><fmt:formatNumber value="${voNotGetMoneyList.vnGrossAmount }" pattern="###,###.00"/></td>
										<td><span class="fa-stack fa-lg" style="color:red"> <i class="fa fa-circle fa-stack-2x"></i> <i class="fa fa-times fa-stack-1x fa-inverse"></i> </span></td>
									</tr>	
									</c:forEach>
								</c:when>
								<c:otherwise>
									<tr class="even"><td valign="top" colspan="5">ไม่พบรายการข้อมูล</td></tr>
								</c:otherwise>
							</c:choose>
														
											
						</table>
						
				</div>				
				
				</div>
				<!-- End Form-2 -->
				
				
				<div id="form-3" class="form-step">
				
				<div class="form-detail clearfix" style="width:60%" >
				
	
						<h4><i class="fa fa-check-square-o"></i> รายงาน</h4>
						<table  class="table-list mt-10" >

							<tr>
								<th style="width:30%; text-align:right">พนักงานรับเงิน</th>
								<td>
									<select class="form-control" id="InputEmployee" name="InputEmployee" style="width: 250px;">
											<option value="">-- เลือกพนักงาน --</option>
									</select>
								</td>
								
							</tr>
							<tr>
								<th style="width:30%; text-align:right">รหัสรับเงิน</th>
								<td>
									<select class="form-control" id="InputReceiveCode" name="InputReceiveCode" style="width: 250px;">
										<option value="">-- เลือกรหัสรับเงิน --</option>
									</select>
								</td>
								
							</tr>
							<tr>
								<th style="width:30%; text-align:right">ประเภทรายงาน</th>
								<td><select class="form-control" id="inputReportType" name="inputReportType" style="width: 250px;">
												<option value="before_receive"> รายงานปิดการรับเงิน </option>
												<option value="water_per_day"> รายงานสรุปค่าน้ำประจำวัน </option>
												<option value="waste_pre_day"> รายงานสรุปค่าขยะประจำวัน </option>
												<option value="wastewater_pre_day"> รายงานสรุปค่าบำบัดน้ำเสียประจำวัน </option>
												<option value="other_per_day"> รายงานสรุปค่าอื่นๆประจำวัน </option>
												<option value="revenue_per_day"> รายงานสรุปรายได้รวมประจำวัน </option>
											</select></td>
								
							</tr>	
						</table>
						<div class="text-center mt-20">
							<button type="button" class="btn btn-primary" onclick="printReport();"><i class="fa fa-file-text-o"></i> ดูรายงาน</button>
						</div>
				
				</div>
				<!-- ### Modal Popup ### -->
				<div class="modal fade" id="warningModal" tabindex="-1" role="dialog" aria-labelledby="warningModal" aria-hidden="true">
				  	  <div class="modal-dialog">
				        <div class="modal-content">
				            <div class="modal-header">
				            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
				            <h4 class="modal-title">กรุณากรอกข้อมูลให้ครบถ้วน</h4>
				            </div>
				            <div class="modal-body">
				            	<div id="modal_content"></div>
				            </div>
				            <div class="modal-footer">
				                <button type="button" class="btn btn-danger" data-dismiss="modal">ยกเลิก</button>    
				        	</div>
				    	</div>
				  	</div>
				</div>
				<!-- End form-detail -->
				
				</div>
				<!-- END Form3 -->
				
			</div>
			<!-- End detail-area -->
		
		
			<div id="footer-detail">Copyright © สงวนลิขสิทธิ์ พ.ศ.2557 โดย การประปานครหลวง</div>
		</div>
	</div><!-- End Detail-area-->


</div>
<!-- End Wrapper -->
</body>
</html>